from selenium.webdriver.common.by import By
from core.base_page import BasePage

class LoginPage(BasePage):
    # 元素定位器（私有，只在当前页面使用）
    username_loc = (By.NAME, "loginName")  # 用户名输入框
    password_loc = (By.NAME, "roncooPwd")  # 密码输入框
    login_btn = (By.XPATH, "/html/body/div/div[2]/div[1]/form/div[3]/input")  # 登录按钮

    def input_username(self, username):
        """输入用户名"""
        self.send_keys(self.username_loc, username)
        return self  # 支持链式调用

    def input_password(self, password):
        """输入密码"""
        self.send_keys(self.password_loc, password)
        return self

    def click_login(self):
        """点击登录按钮"""
        self.click(self.login_btn)
        return self



